package com.Example.Model;

import com.protos.Peer;
import com.websocket.Observer;

public class User implements Observer {
    private String name;
    private Peer.Event message;

    public User(String name) {
        this.name = name;
    }

    /**
     *
     * @param message 订阅到的消息
     */
    @Override
    public void notify(Peer.Event message) {
        this.message = message;
        if (message.hasBlk()) {
            readTransNum();
        }
    }

    public void readTransNum() {
        System.out.println(name + " Block内Transactions的条数： " +  message.getBlk().getTransactionsList().size());
    }
}
